﻿
namespace Sex
{
	public partial class Sex : System.Web.UI.Page
	{
        public static class Exif
        {
            public class Entry
            {
                int _Id;
                public int Id
                {
                    get
                    {
                        return _Id;
                    }
                }
                string _Name;
                public string Name
                {
                    get
                    {
                        return _Name;
                    }
                }
                public Entry(int Id, string Name)
                {
                    _Id = Id;
                    _Name = Name;
                }
            }
            // http://www.awaresystems.be/imaging/tiff.html
            public static Entry[] Entries = new Entry[]
                {
                    new Entry(0x0000, "GpsVer"),
                    new Entry(0x0001, "GpsLatitudeRef"),
                    new Entry(0x0002, "GpsLatitude"),
                    new Entry(0x0003, "GpsLongitudeRef"),
                    new Entry(0x0004, "GpsLongitude"),
                    new Entry(0x0005, "GpsAltitudeRef"),
                    new Entry(0x0006, "GpsAltitude"),
                    new Entry(0x0007, "GpsGpsTime"),
                    new Entry(0x0008, "GpsGpsSatellites"),
                    new Entry(0x0009, "GpsGpsStatus"),
                    new Entry(0x000A, "GpsGpsMeasureMode"),
                    new Entry(0x000B, "GpsGpsDop"),
                    new Entry(0x000C, "GpsSpeedRef"),
                    new Entry(0x000D, "GpsSpeed"),
                    new Entry(0x000E, "GpsTrackRef"),
                    new Entry(0x000F, "GpsTrack"),
                    new Entry(0x0010, "GpsImgDirRef"),
                    new Entry(0x0011, "GpsImgDir"),
                    new Entry(0x0012, "GpsMapDatum"),
                    new Entry(0x0013, "GpsDestLatRef"),
                    new Entry(0x0014, "GpsDestLat"),
                    new Entry(0x0015, "GpsDestLongRef"),
                    new Entry(0x0016, "GpsDestLong"),
                    new Entry(0x0017, "GpsDestBearRef"),
                    new Entry(0x0018, "GpsDestBear"),
                    new Entry(0x0019, "GpsDestDistRef"),
                    new Entry(0x001A, "GpsDestDist"),
                    new Entry(0x001B, "GpsProcessingMethod"),
                    new Entry(0x001C, "GpsAreaInformation"),
                    new Entry(0x001D, "GpsDateStamp"),
                    new Entry(0x001E, "GpsDifferential"),
                    new Entry(0x00FE, "NewSubfileType"),
                    new Entry(0x00FF, "SubfileType"),
                    new Entry(0x0100, "ImageWidth"),
                    new Entry(0x0101, "ImageHeight"),
                    new Entry(0x0102, "BitsPerSample"),
                    new Entry(0x0103, "Compression"),
                    new Entry(0x0106, "PhotometricInterp"),
                    new Entry(0x0107, "ThreshHolding"),
                    new Entry(0x0108, "CellWidth"),
                    new Entry(0x0109, "CellHeight"),
                    new Entry(0x010A, "FillOrder"),
                    new Entry(0x010D, "DocumentName"),
                    new Entry(0x010E, "ImageDescription"),
                    new Entry(0x010F, "EquipMake"),
                    new Entry(0x0110, "EquipModel"),
                    new Entry(0x0111, "StripOffsets"),
                    new Entry(0x0112, "Orientation"),
                    new Entry(0x0115, "SamplesPerPixel"),
                    new Entry(0x0116, "RowsPerStrip"),
                    new Entry(0x0117, "StripBytesCount"),
                    new Entry(0x0118, "MinSampleValue"),
                    new Entry(0x0119, "MaxSampleValue"),
                    new Entry(0x011A, "XResolution"),
                    new Entry(0x011B, "YResolution"),
                    new Entry(0x011C, "PlanarConfig"),
                    new Entry(0x011D, "PageName"),
                    new Entry(0x011E, "XPosition"),
                    new Entry(0x011F, "YPosition"),
                    new Entry(0x0120, "FreeOffset"),
                    new Entry(0x0121, "FreeByteCounts"),
                    new Entry(0x0122, "GrayResponseUnit"),
                    new Entry(0x0123, "GrayResponseCurve"),
                    new Entry(0x0124, "T4Option"),
                    new Entry(0x0125, "T6Option"),
                    new Entry(0x0128, "ResolutionUnit"),
                    new Entry(0x0129, "PageNumber"),
                    new Entry(0x012D, "TransferFunction"),
                    new Entry(0x0131, "SoftwareUsed"),
                    new Entry(0x0132, "DateTime"),
                    new Entry(0x013B, "Artist"),
                    new Entry(0x013C, "HostComputer"),
                    new Entry(0x013D, "Predictor"),
                    new Entry(0x013E, "WhitePoint"),
                    new Entry(0x013F, "PrimaryChromaticities"),
                    new Entry(0x0140, "ColorMap"),
                    new Entry(0x0141, "HalftoneHints"),
                    new Entry(0x0142, "TileWidth"),
                    new Entry(0x0143, "TileLength"),
                    new Entry(0x0144, "TileOffset"),
                    new Entry(0x0145, "TileByteCounts"),
                    new Entry(0x0146, "BadFaxLines"),
                    new Entry(0x0147, "CleanFaxData"),
                    new Entry(0x0148, "ConsecutiveBadFaxLines"),
                    new Entry(0x014A, "SubIFDs"),
                    new Entry(0x014C, "InkSet"),
                    new Entry(0x014D, "InkNames"),
                    new Entry(0x014E, "NumberOfInks"),
                    new Entry(0x0150, "DotRange"),
                    new Entry(0x0151, "TargetPrinter"),
                    new Entry(0x0152, "ExtraSamples"),
                    new Entry(0x0153, "SampleFormat"),
                    new Entry(0x0154, "SMinSampleValue"),
                    new Entry(0x0155, "SMaxSampleValue"),
                    new Entry(0x0156, "TransferRange"),
                    new Entry(0x0157, "ClipPath"),
                    new Entry(0x0158, "XClipPathUnits"),
                    new Entry(0x0159, "YClipPathUnits"),
                    new Entry(0x015A, "Indexed"),
                    new Entry(0x015B, "JPEGTables"),
                    new Entry(0x015F, "OPIProxy"),
                    new Entry(0x0190, "GlobalParametersIFD"),
                    new Entry(0x0191, "ProfileType"),
                    new Entry(0x0192, "FaxProfile"),
                    new Entry(0x0193, "CodingMethods"),
                    new Entry(0x0194, "VersionYear"),
                    new Entry(0x0195, "ModeNumber"),
                    new Entry(0x01B1, "Decode"),
                    new Entry(0x01B2, "DefaultImageColor"),
                    new Entry(0x0200, "JPEGProc"),
                    new Entry(0x0201, "JPEGInterFormat"),
                    new Entry(0x0202, "JPEGInterLength"),
                    new Entry(0x0203, "JPEGRestartInterval"),
                    new Entry(0x0205, "JPEGLosslessPredictors"),
                    new Entry(0x0206, "JPEGPointTransforms"),
                    new Entry(0x0207, "JPEGQTables"),
                    new Entry(0x0208, "JPEGDCTables"),
                    new Entry(0x0209, "JPEGACTables"),
                    new Entry(0x0211, "YCbCrCoefficients"),
                    new Entry(0x0212, "YCbCrSubsampling"),
                    new Entry(0x0213, "YCbCrPositioning"),
                    new Entry(0x0214, "REFBlackWhite"),
                    new Entry(0x022F, "StripRowCounts"),
                    new Entry(0x02BC, "XMP"),
                    new Entry(0x0301, "Gamma"),
                    new Entry(0x0302, "ICCProfileDescriptor"),
                    new Entry(0x0303, "SRGBRenderingIntent"),
                    new Entry(0x0320, "ImageTitle"),
                    new Entry(0x5001, "ResolutionXUnit"),
                    new Entry(0x5002, "ResolutionYUnit"),
                    new Entry(0x5003, "ResolutionXLengthUnit"),
                    new Entry(0x5004, "ResolutionYLengthUnit"),
                    new Entry(0x5005, "PrintFlags"),
                    new Entry(0x5006, "PrintFlagsVersion"),
                    new Entry(0x5007, "PrintFlagsCrop"),
                    new Entry(0x5008, "PrintFlagsBleedWidth"),
                    new Entry(0x5009, "PrintFlagsBleedWidthScale"),
                    new Entry(0x500A, "HalftoneLImage_pi"),
                    new Entry(0x500B, "HalftoneLImage_piUnit"),
                    new Entry(0x500C, "HalftoneDegree"),
                    new Entry(0x500D, "HalftoneShape"),
                    new Entry(0x500E, "HalftoneMisc"),
                    new Entry(0x500F, "HalftoneScreen"),
                    new Entry(0x5010, "JPEGQuality"),
                    new Entry(0x5011, "GridSize"),
                    new Entry(0x5012, "ThumbnailFormat"),
                    new Entry(0x5013, "ThumbnailWidth"),
                    new Entry(0x5014, "ThumbnailHeight"),
                    new Entry(0x5015, "ThumbnailColorDepth"),
                    new Entry(0x5016, "ThumbnailPlanes"),
                    new Entry(0x5017, "ThumbnailRawBytes"),
                    new Entry(0x5018, "ThumbnailSize"),
                    new Entry(0x5019, "ThumbnailCompressedSize"),
                    new Entry(0x501A, "ColorTransferFunction"),
                    new Entry(0x501B, "ThumbnailData"),
                    new Entry(0x5020, "ThumbnailImageWidth"),
                    new Entry(0x5021, "ThumbnailImageHeight"),
                    new Entry(0x5022, "ThumbnailBitsPerSample"),
                    new Entry(0x5023, "ThumbnailCompression"),
                    new Entry(0x5024, "ThumbnailPhotometricInterp"),
                    new Entry(0x5025, "ThumbnailImageDescription"),
                    new Entry(0x5026, "ThumbnailEquipMake"),
                    new Entry(0x5027, "ThumbnailEquipModel"),
                    new Entry(0x5028, "ThumbnailStripOffsets"),
                    new Entry(0x5029, "ThumbnailOrientation"),
                    new Entry(0x502A, "ThumbnailSamplesPerPixel"),
                    new Entry(0x502B, "ThumbnailRowsPerStrip"),
                    new Entry(0x502C, "ThumbnailStripBytesCount"),
                    new Entry(0x502D, "ThumbnailResolutionX"),
                    new Entry(0x502E, "ThumbnailResolutionY"),
                    new Entry(0x502F, "ThumbnailPlanarConfig"),
                    new Entry(0x5030, "ThumbnailResolutionUnit"),
                    new Entry(0x5031, "ThumbnailTransferFunction"),
                    new Entry(0x5032, "ThumbnailSoftwareUsed"),
                    new Entry(0x5033, "ThumbnailDateTime"),
                    new Entry(0x5034, "ThumbnailArtist"),
                    new Entry(0x5035, "ThumbnailWhitePoint"),
                    new Entry(0x5036, "ThumbnailPrimaryChromaticities"),
                    new Entry(0x5037, "ThumbnailYCbCrCoefficients"),
                    new Entry(0x5038, "ThumbnailYCbCrSubsampling"),
                    new Entry(0x5039, "ThumbnailYCbCrPositioning"),
                    new Entry(0x503A, "ThumbnailRefBlackWhite"),
                    new Entry(0x503B, "ThumbnailCopyRight"),
                    new Entry(0x5090, "LuminanceTable"),
                    new Entry(0x5091, "ChrominanceTable"),
                    new Entry(0x5100, "FrameDelay"),
                    new Entry(0x5101, "LoopCount"),
                    new Entry(0x5102, "GlobalPalette"),
                    new Entry(0x5103, "IndexBackground"),
                    new Entry(0x5104, "IndexTransparent"),
                    new Entry(0x5110, "PixelUnit"),
                    new Entry(0x5111, "PixelPerUnitX"),
                    new Entry(0x5112, "PixelPerUnitY"),
                    new Entry(0x5113, "PaletteHistogram"),
                    new Entry(0x800D, "ImageID"),
                    new Entry(0x80A4, "Wang Annotation"),
                    new Entry(0x8298, "Copyright"),
                    new Entry(0x829A, "ExifExposureTime"),
                    new Entry(0x829D, "ExifFNumber"),
                    new Entry(0x82A5, "MD FileTag"),
                    new Entry(0x82A6, "MD ScalePixel"),
                    new Entry(0x82A7, "MD ColorTable"),
                    new Entry(0x82A8, "MD LabName"),
                    new Entry(0x82A9, "MD SampleInfo"),
                    new Entry(0x82AA, "MD PrepDate"),
                    new Entry(0x82AB, "MD PrepTime"),
                    new Entry(0x82AC, "MD FileUnits"),
                    new Entry(0x830E, "ModelPixelScaleTag"),
                    new Entry(0x83BB, "IPTC"),
                    new Entry(0x847E, "INGR Packet Data Tag"),
                    new Entry(0x847F, "INGR Flag Registers"),
                    new Entry(0x8480, "IrasB Transformation Matrix"),
                    new Entry(0x8482, "ModelTiepointTag"),
                    new Entry(0x85D8, "ModelTransformationTag"),
                    new Entry(0x8649, "Photoshop"),
                    new Entry(0x8769, "ExifIFD"),
                    new Entry(0x8773, "ICCProfile"),
                    new Entry(0x87AC, "ImageLayer"),
                    new Entry(0x87AF, "GeoKeyDirectoryTag"),
                    new Entry(0x87B0, "GeoDoubleParamsTag"),
                    new Entry(0x87B1, "GeoAsciiParamsTag"),
                    new Entry(0x8822, "ExifExposureProg"),
                    new Entry(0x8824, "ExifSpectralSense"),
                    new Entry(0x8825, "GpsIFD"),
                    new Entry(0x8827, "ExifISOSpeed"),
                    new Entry(0x8828, "ExifOECF"),
                    new Entry(0x885C, "HylaFAX FaxRecvParams"),
                    new Entry(0x885D, "HylaFAX FaxSubAddress"),
                    new Entry(0x885E, "HylaFAX FaxRecvTime"),
                    new Entry(0x9000, "ExifVer"),
                    new Entry(0x9003, "ExifDTOrig"),
                    new Entry(0x9004, "ExifDTDigitized"),
                    new Entry(0x9101, "ExifCompConfig"),
                    new Entry(0x9102, "ExifCompBPP"),
                    new Entry(0x9201, "ExifShutterSpeed"),
                    new Entry(0x9202, "ExifAperture"),
                    new Entry(0x9203, "ExifBrightness"),
                    new Entry(0x9204, "ExifExposureBias"),
                    new Entry(0x9205, "ExifMaxAperture"),
                    new Entry(0x9206, "ExifSubjectDist"),
                    new Entry(0x9207, "ExifMeteringMode"),
                    new Entry(0x9208, "ExifLightSource"),
                    new Entry(0x9209, "ExifFlash"),
                    new Entry(0x920A, "ExifFocalLength"),
                    new Entry(0x927C, "ExifMakerNote"),
                    new Entry(0x9286, "ExifUserComment"),
                    new Entry(0x9290, "ExifDTSubsec"),
                    new Entry(0x9291, "ExifDTOrigSS"),
                    new Entry(0x9292, "ExifDTDigSS"),
                    new Entry(0x935C, "ImageSourceData"),
                    new Entry(0xA000, "ExifFPXVer"),
                    new Entry(0xA001, "ExifColorSpace"),
                    new Entry(0xA002, "ExifpixXDim"),
                    new Entry(0xA003, "ExifpixYDim"),
                    new Entry(0xA004, "ExifRelatedWav"),
                    new Entry(0xA005, "ExifInterop"),
                    new Entry(0xA20B, "ExifFlashEnergy"),
                    new Entry(0xA20C, "ExifSpatialFR"),
                    new Entry(0xA20E, "ExifFocalXRes"),
                    new Entry(0xA20F, "ExifFocalYRes"),
                    new Entry(0xA210, "ExifFocalResUnit"),
                    new Entry(0xA214, "ExifSubjectLoc"),
                    new Entry(0xA215, "ExifExposureIndex"),
                    new Entry(0xA217, "ExifSensingMethod"),
                    new Entry(0xA300, "ExifFileSource"),
                    new Entry(0xA301, "ExifSceneType"),
                    new Entry(0xA302, "ExifCfaPattern"),
                    new Entry(0xA401, "CustomRendered"),
                    new Entry(0xA402, "ExposureMode"),
                    new Entry(0xA403, "WhiteBalance"),
                    new Entry(0xA404, "DigitalZoomRatio"),
                    new Entry(0xA405, "FocalLengthIn35mmFilm"),
                    new Entry(0xA406, "SceneCaptureType"),
                    new Entry(0xA407, "GainControl"),
                    new Entry(0xA408, "Contrast"),
                    new Entry(0xA409, "Saturation"),
                    new Entry(0xA40A, "Sharpness"),
                    new Entry(0xA40B, "DeviceSettingDescription"),
                    new Entry(0xA40C, "SubjectDistanceRange"),
                    new Entry(0xA420, "ImageUniqueID"),
                    new Entry(0xA480, "GDAL_METADATA"),
                    new Entry(0xA481, "GDAL_NODATA"),
                    new Entry(0xC427, "Oce Scanjob Description"),
                    new Entry(0xC428, "Oce Application Selector"),
                    new Entry(0xC429, "Oce Identification Number"),
                    new Entry(0xC42A, "Oce ImageLogic Characteristics"),
                    new Entry(0xC612, "DNGVersion"),
                    new Entry(0xC613, "DNGBackwardVersion"),
                    new Entry(0xC614, "UniqueCameraModel"),
                    new Entry(0xC615, "LocalizedCameraModel"),
                    new Entry(0xC616, "CFAPlaneColor"),
                    new Entry(0xC617, "CFALayout"),
                    new Entry(0xC618, "LinearizationTable"),
                    new Entry(0xC619, "BlackLevelRepeatDim"),
                    new Entry(0xC61A, "BlackLevel"),
                    new Entry(0xC61B, "BlackLevelDeltaH"),
                    new Entry(0xC61C, "BlackLevelDeltaV"),
                    new Entry(0xC61D, "WhiteLevel"),
                    new Entry(0xC61E, "DefaultScale"),
                    new Entry(0xC61F, "DefaultCropOrigin"),
                    new Entry(0xC620, "DefaultCropSize"),
                    new Entry(0xC621, "ColorMatrix1"),
                    new Entry(0xC622, "ColorMatrix2"),
                    new Entry(0xC623, "CameraCalibration1"),
                    new Entry(0xC624, "CameraCalibration2"),
                    new Entry(0xC625, "ReductionMatrix1"),
                    new Entry(0xC626, "ReductionMatrix2"),
                    new Entry(0xC627, "AnalogBalance"),
                    new Entry(0xC628, "AsShotNeutral"),
                    new Entry(0xC629, "AsShotWhiteXY"),
                    new Entry(0xC62A, "BaselineExposure"),
                    new Entry(0xC62B, "BaselineNoise"),
                    new Entry(0xC62C, "BaselineSharpness"),
                    new Entry(0xC62D, "BayerGreenSplit"),
                    new Entry(0xC62E, "LinearResponseLimit"),
                    new Entry(0xC62F, "CameraSerialNumber"),
                    new Entry(0xC630, "LensInfo"),
                    new Entry(0xC631, "ChromaBlurRadius"),
                    new Entry(0xC632, "AntiAliasStrength"),
                    new Entry(0xC634, "DNGPrivateData"),
                    new Entry(0xC635, "MakerNoteSafety"),
                    new Entry(0xC65A, "CalibrationIlluminant1"),
                    new Entry(0xC65B, "CalibrationIlluminant2"),
                    new Entry(0xC65C, "BestQualityScale"),
                    new Entry(0xC660, "Alias Layer Metadata"),
            };
            public static string GetName(int ExifIdToFind)
            {
                for (int i = 0; i < Entries.Length; i++)
                {
                    if (ExifIdToFind == Entries[i].Id)
                        return Entries[i].Name;
                }
                return "Id" + ExifIdToFind.ToString();
            }
        }
    }
}